package com.lovo.game;

import javax.swing.*;

public class GuessGame {
    public static Player player = new Player();
    public static Computer computer = new Computer();

    public void run() {
        int playerScore = 0;
        for (int i = 0; i < 10; i++) {
            switch (player.guess() - computer.guess()) {
                case 0:
                    playerScore += 0;
                    System.out.println("第" + (i + 1) + "局" + "平局");
                    break;
                case 1:
                    playerScore -= 1;
                    System.out.println("第" + (i + 1) + "局" + "你输了扣一分");
                    break;
                case -1:
                    playerScore += 1;
                    System.out.println("第" + (i + 1) + "局" + "你赢了加一分");
                    break;
                case 2:
                    playerScore += 1;
                    System.out.println("第" + (i + 1) + "局" + "你赢了加一分");
                    break;
                case -2:
                    playerScore -= 1;
                    System.out.println("第" + (i + 1) + "局" + "你输了扣一分");
                    break;
            }
        }
        if (playerScore > 0) {
            System.out.println("你赢了");
        } else {
            System.out.println("你输了");
        }


    }

    public static void main(String[] args) {
        GuessGame a = new GuessGame();
        a.run();
    }
}